// 引入封装的axios
import request from '@/utils/request';
import type { CategoryListModel } from './model/categoryModel';

// 使用枚举定义接口
enum Api {
  getCategory1ListApi = '/admin/product/getCategory1', // 获取一级数据
  getCategory2ListApi = '/admin/product/getCategory2', // 获取二级数据 
  getCategory3ListApi = '/admin/product/getCategory3', // 获取三级数据
};

// 1、获取一级数据
export const reqGetCategory1ListData = () => {
  return request.get<any, CategoryListModel>(Api.getCategory1ListApi);
};

// 2、获取二级数据
export const reqGetCategory2ListData = (category1Id: number) => {
  return request.get<any, CategoryListModel>(`${Api.getCategory2ListApi}/${category1Id}`)
};

// 3、获取三级数据
export const reqGetCategory3ListData = (category2Id: number) => {
  return request.get<any, CategoryListModel>(`${Api.getCategory3ListApi}/${category2Id}`)
};



